<template>
    <div class="ReportList">
        <mt-header fixed title="审核举报列表">
            <mt-button icon="back" @click="back" slot="left"></mt-button>
        </mt-header>
        <mt-tab-container style="margin-top: 40px;" >
            <mt-tab-container-item>
                <a class="mint-cell" style="padding: 10px;" v-for="(n,index) in reportList">
                    <div class="mint-cell-left"></div>
                    <div class="mint-cell-wrapper">
                        <div class="mint-cell-title">
                            <span class="mint-cell-text">举报内容:{{n.content}}</span>
                            <span class="mint-cell-label">举报人昵称:{{n.nickname}}</span>
                            <span class="mint-cell-label">被举报人昵称:{{n.complaintName}}</span>
                        </div>
                        <!--<div class="mint-cell-value" @click="deleteReport(n.complaintId,1)">-->
                            <!--<button class="mint-button mint-button&#45;&#45;primary mint-button&#45;&#45;small">-->
                                <!--<label class="mint-button-text">属实</label></button>-->
                        <!--</div>-->
                        <!--<div class="mint-cell-value" @click="deleteReport(n.complaintId,2)" style="margin-left: 10px;">-->
                            <!--<button class="mint-button mint-button&#45;&#45;danger mint-button&#45;&#45;small">-->
                             <!--<label class="mint-button-text">驳回</label></button>-->
                        <!--</div>-->
                        <router-link  :to="{ path: '/ReportDetails', query: { id: n.complaintId , listdata : n }}">
                            <mt-button type="primary"  size="small">查看详情</mt-button>
                        </router-link>
                    </div>
                    <!--<div class="mint-cell-wrapper" style=" margin-top: 10px;">-->
                        <!--<div v-for="srcUrl in n.images" style="width: 100%;">-->
                            <!--<img  style="width: 100%" :src="srcUrl" />-->
                        <!--</div>-->
                    <!--</div>-->
                    <div class="mint-cell-right"></div>
                  </a>
            </mt-tab-container-item>

        </mt-tab-container>
    </div>
</template>

<script>
    import {
            complaintlist,
            complaint,
            loading,
            back,
    } from '../common/api/api';
    import { Toast ,Indicator} from 'mint-ui';
    export default {
        name: 'ReportList',
        data () {
            return {
                articles:[],
                createDialog: {
                    opened: false,
                    loading: false
                },
//                nickname : null,
//                complaintName : null,
//                content : null,
                reportList : [],
            }
        },
        components: {
            //Hello
        },
        methods: {
            back : back,
            deleteReport: function (complaintId,status) {
                var vm = this;
                const params = {
                    complaintId : complaintId,
                    status : status
                }
                loading(true);
                complaint(params, {
                    target: vm.createDialog
                })
                        .then((data) => {
                    console.log(data);
                vm.createDialog.opened = false;
                if(data.errno == 0){
                    loading(false);
                    vm.initData()
                    Toast('操作成功');
                }else{
                    loading(false);
                    Toast(data.errmsg);
                }

//                  vm.$router.push({
//                      name: "UserOrder",
//                      params: { handleId: 1 }
//                  });
            });
            },
            initData : function () {
                var vm = this;
                const params = {

                }
                loading(true);
                complaintlist(params, {
                    target: vm.createDialog
                })
                        .then((result) => {
                    console.log(result);
                vm.createDialog.opened = false;
                if(result.errno == 0){
                    loading(false);
                    vm.reportList = result.data.data;

                }else{
                    loading(false);
                    Toast(data.errmsg);
                }

            });
            }
        },
        created() {
            this.initData()
        },
    }
</script>
